﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Threading;
using Core.Unity;
using Core.Unity.Wpf;

namespace ViewModels {
    public class TextHintViewModel : INotifyPropertyChanged, ITextHint {
        public event PropertyChangedEventHandler PropertyChanged;

        Dispatcher _Dispatcher = System.Windows.Application.Current.Dispatcher;
        private ContainerWpf _container;
        ObservableCollection<string> _TipList = new ObservableCollection<string>();

        public ObservableCollection<string> TipList {
            get {
                return _TipList;
            }
        }

        public TextHintViewModel(ContainerWpf container) {
            _container = container;
            container.Register<ITextHint>(this);
        }

        public void AddText(string tip) {
            _Dispatcher.BeginInvoke(new Action(() => {
                TipList.Add(tip);
            }));
        }
    }

    public interface ITextHint {
        void AddText(string tip);
    }
}
